package com.gaga.common.enums;

import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * 推送消息类型枚举
 *
 * @author liujia
 * @version 1.0
 * @date 2025/2/25-16:26
 */
@Getter
public enum PushMessageType {
    HEARTBEAT("HEARTBEAT", "心跳", false),
    insertAudioWaitGen("insertAudioWaitGen", "插播音频待生成区", true),
    insertAudioWaitPlay("insertAudioWaitPlay", "插播音频待播放区", true),
    keywordWaitGen("keywordWaitGen", "关键字待生成区", true),
    keywordWaitPlay("keywordWaitPlay", "关键字待播放区", true),
    userEnterWaitGen("userEnterWaitGen", "用户进入待生成区", true),
    userEnterWaitPlay("userEnterWaitPlay", "用户进入待播放区", true),
    randomAudioWaitGen("randomAudioWaitGen", "随机音频待生成区", true),
    randomAudioWaitPlay("randomAudioWaitPlay", "随机音频待播放区", true),
    mainAudioPlayFile("mainAudioPlayFile", "主音频播放文件", true),
    playLog("playLog", "播放日志", false),
    startLiveStep("startLiveStep", "开启直播流程", true),
    liveError("liveError", "直播错误信息", true),
    ;

    private final String type;
    private final String desc;
    private final Boolean isCleanWhenStop;

    PushMessageType(String type, String desc, Boolean isCleanWhenStop) {
        this.type = type;
        this.desc = desc;
        this.isCleanWhenStop = isCleanWhenStop;
    }

    /**
     * 获取停止直播时需要清理的
     *
     * @return
     */
    public static List<PushMessageType> getNeedCleanTypeList() {
        List<PushMessageType> list = new ArrayList<>();
        for (PushMessageType value : values()) {
            if (value.isCleanWhenStop) {
                list.add(value);
            }
        }
        return list;
    }

}